package org.nanhill.gecko;

import java.net.Authenticator;
import java.net.PasswordAuthentication;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class DumbAuthenticator extends Authenticator {
	private final static Log logger = LogFactory
			.getLog(DumbAuthenticator.class);

	private final String user;

	private final String password;

	public DumbAuthenticator(String user, String password) {
		// if (logger.isDebugEnabled()) {
		// logger.debug("DumbAuthenticator(" + user + ", ***)");
		// }
		this.user = user;
		this.password = password;
	}

	public PasswordAuthentication getPasswordAuthentication() {
		if (logger.isDebugEnabled()) {
			logger.debug("getPasswordAuthentication()");
		}
		return new PasswordAuthentication(user, password.toCharArray());
	}
}
